package org.firegrid.view.zk;

import java.util.HashMap;
import java.util.Map;

import org.firegrid.model.Form;
import org.firegrid.view.zk.util.MainForward;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Textbox;

public class FlowDesignComposer extends GenericForwardComposer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5366581246941833747L;
	private Button nextBtn;
	private Textbox fname;
	private Form ppt;

	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		ppt = (Form) comp.getAttribute("ppt");
	}

	public void onNext(Event event) {
		if (ppt == null) {
			ppt = new Form();
		}
		ppt.setFname(fname.getValue());
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("parent", ppt);
		MainForward.forwardNoClear(params, "/flow_design_fs.zul");
	}
}
